﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test.Site.Data.Models
{
    public class JQueryFileInputPreviewModel
    {
        public string Url { get; set; } = "javascript:void(0);";
        public string Src { get; set; }
    }
    

    public class JQueryFileInputPreviewConfigModel
    {
        public string width { get; set; } = "160px";
        public string url { get; set; }
        public object extra { get; set; }
    }

    public class JQueryFileInputModel
    {
        /// <summary>
        /// 语言
        /// </summary>
        public string language { get; set; } = "zh";

        public List<JQueryFileInputPreviewModel> Previews { private get; set; } = new List<JQueryFileInputPreviewModel>();

        public List<string> initialPreview
        {
            get
            {
                return Previews.Select(p => 
                $"'<a href=\"{p.Url}\"><img src=\"{p.Src}\" class=\"file-preview-image\" alt=\"\" title=\"\"></a>'").ToList();
            }
        }

        public List<JQueryFileInputPreviewConfigModel> initialPreviewConfig { get; set; }

        public bool initialPreviewShowDelete { get; set; } = true;

        public bool overwriteInitial { get; set; } = false;

        public int maxFileCount { get; set; } = 10;

        public int maxFileSize { get; set; } = 4096;

        public bool showRemove { get; set; } = true;

        public bool showUpload { get; set; } = false;

        /// <summary>
        /// 标题
        /// </summary>
        public string initialCaption { get; set; }

        public string[] allowedFileExtensions { get; set; } = new string[] { "jpg", "jpeg", "png", "gif" };

        public int maxImageWidth { get; set; } = 800;

        public bool resizeImage { get; set; } = true;

    }

}
